﻿using System;
using System.Collections.Generic;
using StockholmsStad.Runtime.Serialization.DataContract;

namespace StockholmsStad.Data.Interfaces
{
    /// <summary>
    /// Administrerar ceremonier
    /// </summary>
    public interface ICeremonyAgent
    {
        /// <summary>
        /// Lägg till en ny ceremoni
        /// </summary>
        /// <param name="context">Det databascontext som operationen köra i</param>
        /// <param name="ceremony">Ceremonin som ska läggas till </param>
        /// <returns></returns>
        int AddCeremony(IDataContext context, Ceremony ceremony);

        /// <summary>
        /// Hämtar id-numret för en ceremoni
        /// </summary>
        /// <param name="context">Det databascontext som operationen köra i</param>
        /// <param name="ticketId">Nyckeln på ärendet som ceremonin hör till. </param>
        int GetCeremonyId(IDataContext context, int ticketId);
            
        /// <summary>
        /// Hämta information om en ceremoni
        /// </summary>
        /// <param name="context">Det databascontext som operationen köra i</param>
        /// <param name="ceremonyId">Nyckeln på ceremonin som ska hämtas</param>
        /// <returns>Ceremonin</returns>
        Ceremony GetCeremony(IDataContext context, int ceremonyId);

        /// <summary>
        /// Ta bort en ceremoni
        /// </summary>
        /// <param name="context">Det databascontext som operationen köra i</param>
        /// <param name="ceremonyId">Cermeonin som ska tas bort</param>
        void DeleteCeremony(IDataContext context, int ceremonyId);

        /// <summary>
        /// Tar bort information om hindersprövning. 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="ceremonyId"></param>
        void RemoveImpedimentsDates(IDataContext context, int ceremonyId);

        /// <summary>
        /// Uppdaterar ceremoni med uppgifter om att paret har skyddade personuppgifter
        /// </summary>
        /// <param name="context">Det databascontext som operationen köra i</param>
        /// <param name="ceremonyId">Ceremonin som ska uppdateras</param>
        void UpdateCeremonyWithProtectedIdentity(IDataContext context, int ceremonyId);
        
        /// <summary>
        /// Uppdatera befintlig ceremoni
        /// </summary>
        /// <param name="context">Det databascontext som operationen köra i</param>
        /// <param name="ceremonyId">Ceremonin som ska uppdateras</param>
        /// <param name="ceremony">Nytt värde på ceremoni</param>
        void UpdateCeremony(IDataContext context, int ceremonyId, Ceremony ceremony);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="ceremonyId"></param>
        /// <param name="ceremony"></param>
        /// <param name="booking"></param>
        void UpdateCeremonyBookingDetails(IDataContext context, int ceremonyId, Ceremony ceremony, Booking booking);

        /// <summary>
        /// Returnerar möjliga hjälpmedel för en ceremoni
        /// </summary>
        /// <param name="context">Det databascontext som operationen köra i</param>
        /// <returns></returns>
        List<ValueIdPair> GetSpecialNeeds(IDataContext context);

        /// <summary>
        /// Lägger in ett nytt hjälpmedel
        /// </summary>
        /// <param name="context">Det databascontext som operationen köra i</param>
        /// <param name="specialNeed"></param>
        /// <returns></returns>
        int AddSpecialNeed(IDataContext context, string specialNeed);

        ///<summary>
        /// Nollställer flaggan för att hindersprövning har inkommit
        /// samt flaggan för att påminnelse om att ta bort bokning
        /// Bör köras då en bokning ändras eller då ceremoniinformation uppdateras.
        ///</summary>
        ///<param name="context"></param>
        ///<param name="ticketId"></param>
        void ResetCeremonyFlags(IDataContext context, int ticketId);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        List<CeremonySummary> GetIndividualCeremonyBooking(IDataContext context, DateTime dateTime);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <param name="ministerId"></param>
        /// <returns></returns>
        List<CeremonySummary> GetIndividualCeremonyBooking(IDataContext context, DateTime fromDate, DateTime? toDate, int? ministerId);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="dateTime"></param>
        /// <param name="ministerId"></param>
        /// <returns></returns>
        List<CeremonySummaryDetails> GetIndividualCeremonyBookingDetails(IDataContext context, DateTime dateTime, int? ministerId);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        List<CeremonySummary> GetOrdinaryCeremonyBooking(IDataContext context, DateTime dateTime);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <param name="ministerId"></param>
        /// <returns></returns>
        List<CeremonySummary> GetOrdinaryCeremonyBooking(IDataContext context, DateTime fromDate, DateTime? toDate, int? ministerId);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="dateTime"></param>
        /// <returns></returns>
        List<CeremonySummaryDetails> GetOrdinaryCeremonyBookingDetails(IDataContext context, DateTime dateTime);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        DateTime GetNextCeremonyDateForIndividualService(IDataContext context);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        DateTime GetNextCeremonyDateForOrdinaryService(IDataContext context);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        DateTime GetPreviousCeremonyDateForIndividualService(IDataContext context);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        DateTime GetPreviousCeremonyDateForOrdinaryService(IDataContext context);

        /// <summary>
        /// Sätter hindersprövningsdatum om ärendet har en bokning
        /// </summary>
        /// <param name="context"></param>
        /// <param name="booking"></param>
        /// <param name="contractCeremony"></param>
        void GetImpedimentDates(IDataContext context, Booking booking, Ceremony contractCeremony);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="ceremonyId"></param>
        /// <param name="ticket"></param>
        /// <param name="bookingDate"></param>
        void SendConfirmedBookingMail(IDataContext context, int ceremonyId, Ticket ticket, DateTime bookingDate);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <param name="ceremonyId"></param>
        /// <param name="ticket"></param>
        /// <param name="bookingDate"></param>
        /// <param name="forceSendMail"></param>
        void SendConfirmedBookingMail(IDataContext context, int ceremonyId, Ticket ticket, DateTime bookingDate, bool forceSendMail);
    }
}